﻿<%--<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<CRM.Models.TrainingsRequestsExt>" %>--%>
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<CRM.Database.Model.TrainingsRequestsExt>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Новая заявка на плановый курс
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h2>Новая заявка на плановый курс</h2>
    <% using (Html.BeginForm("TrainingsPlannedRequestCreate", "TC", FormMethod.Post, new { @class = "edit_form" }))
       { %>
    <%: Html.ValidationSummary(true) %>
    <%:Html.Hidden("Request.IdTrainingsRequest")%>
    <%:Html.Hidden("Request.IdTrainingsSchedule")%>
    <%:Html.Hidden("Request.IdCustomer")%>
    <%:Html.Hidden("Key")%>
    <%--<%:Html.Hidden("IdLegalEntity")%>--%>

    <%:Html.DevExpress().Label(
              settings =>
                  {
                      settings.ControlStyle.CssClass = "lable";
                      settings.Text = "Выбранное расписание";
                      settings.Width = 500;
                  }).GetHtml() %>
    <%:Html.Action("TrainingsPlannedRequestSchedulePartial", new {key = Model.Key}) %>

    <br />
    <%:Html.DevExpress().Label(
              settings =>
                  {
                      settings.ControlStyle.CssClass = "lable";
                      settings.Text = "Участники";
                      settings.Width = 500;
                  }).GetHtml() %>
    <% Html.RenderPartial("TrainingsParticipantsPartial"); %>
    
    <br />
  
    <table>
        <tr>
            <td>
                <%:Html.DevExpress().Label(settings =>
                  {
                      settings.ControlStyle.CssClass = "lable";
                      settings.Text = "Название юр. лица";
                      settings.Width = 232;
                  }).GetHtml() %>
                <%: Html.Partial("TrainingsRequestLEPartial", Model)%>
                <%--<% 
                    if (Model.Request.IdLegalEntity > 0)
                    {
                        Html.DevExpress().ComboBox(settings =>
                        {
                            settings.Name = "Request.IdLegalEntity";
                            settings.ControlStyle.CssClass = "editor";
                            settings.Properties.TextField = "Name";
                            settings.Properties.ValueField = "IdLegalEntity";
                            settings.Properties.ValueType = typeof (int);
                            settings.Width = 232;
                        }).BindList(DB.GetCustomerById((int)Model.Request.IdCustomer).LegalEntities).Bind(Model.Request.IdLegalEntity).GetHtml();
                    }else
                    {
                        Html.DevExpress().TextBox(settings =>
                        {
                            settings.Name = "Request.Company";
                            settings.Width = 232;
                            settings.Properties.NullText = "Введите название юр. лица...";
                        }).GetHtml();
                    }
                %>--%>
            </td>
            <td>
                <%--<% 
                    if (Model.Request.IdContact > 0)
                    {
                        Html.DevExpress().ComboBox(settings =>
                        {
                            settings.Name = "Request.IdContact";
                            settings.ControlStyle.CssClass = "editor";
                            settings.Properties.TextField = "Name";
                            settings.Properties.ValueField = "IdContact";
                            settings.Properties.ValueType = typeof (int);
                            settings.Width = 232;
                        }).BindList(DB.GetCustomerById((int)Model.Request.IdCustomer).Contacts).Bind(Model.Request.IdContact).GetHtml();
                    }else
                    {
                        Html.DevExpress().TextBox(settings =>
                        {
                            settings.Name = "Request.ContactName";
                            settings.Width = 232;
                            settings.Properties.NullText = "Введите имя контактного лица...";
                        }).GetHtml();
                    }
                %>--%>
            </td>
        </tr>
        <tr>
            <td>
                <%:Html.DevExpress().Label(settings =>
                  {
                      settings.ControlStyle.CssClass = "lable";
                      settings.Text = "Контакты";
                      settings.Width = 232;
                  }).GetHtml() %>
                <%: Html.Partial("TrainingsRequestContactPartial", Model)%>
                <%--<%:Html.DevExpress().Label(settings =>
                    {
                        settings.ControlStyle.CssClass = "lable";
                        settings.Text = "Контактный телефон";
                        settings.Width = 232;
                    }).GetHtml() %>
                <%:Html.DevExpress().TextBox( settings => 
                    {
                        settings.Name = "Request.ContactPhone";
                        settings.Width = 232;
                        settings.Properties.MaskSettings.Mask = "+7 (999) 000-00-00";
                        settings.Properties.MaskSettings.IncludeLiterals = MaskIncludeLiteralsMode.None;
                    }).GetHtml()%>--%>
            </td>
            <td>
                <%--<%:Html.DevExpress().Label(settings =>
                    {
                        settings.ControlStyle.CssClass = "lable";
                        settings.Text = "Адрес электронной почты";
                        settings.Width = 232;
                    }).GetHtml() %>
                <%:Html.DevExpress().TextBox( settings => 
                    {
                        settings.Name = "Request.ContactEmail";
                        settings.Width = 232;
                        settings.Properties.NullText = "Введите адрес почты";
                    }).GetHtml()%>--%>
            </td>
        </tr>
    </table>
    

    <br />
    <%:Html.DevExpress().Label(
              settings =>
                  {
                      settings.ControlStyle.CssClass = "lable";
                      settings.Text = "Комментарий";
                      settings.Width = 500;
                  }).GetHtml() %>
    <%:Html.DevExpress().TextBox( settings => 
                    {
                        settings.Name = "Request.Comments";
                        settings.Width = 500;
                        settings.Properties.NullText = "Комментарии...";
                    }).GetHtml()%>

    <button type="submit" value="Создать заявку">Создать заявку</button>
    <% } %>
</asp:Content>
